![]() |
FillParseTable |
||||
Header: | Script.h | Carbon status: | Supported | |
Helps your application to quickly process a buffer of mixed 1-byte and 2-byte characters.
Boolean FillParseTable ( CharByteTable table, ScriptCode script );
A 256-byte table to be filled in by FillParseTable.
A value that specifies the script system the parse table belongs to. Constants for all defined script codes are listed in
If you specify smCurrentScript for the script parameter, the value returned by FillParseTable can be affected by the state of the font force flag. It is unaffected by the international resources selection flag.
Before calling FillParseTable, allocate space for a 256-byte table to pass to the function in the table parameter.
This function returns a 256-byte table that distinguishes the character codes of all possible 1-byte characters from the first (high-order) byte values of all possible 2-byte characters in the specified script system. The script system associated with the character you wish to examine must be enabled in order for any of these three functions to provide useful information.
For 1-byte script systems, the character-type tables reside in the string-manipulation ('itl2') resource and reflect region-specific or language-specific differences in uppercase conventions.
For 2-byte script systems, the character-type tables reside in the encoding/rendering ('itl5') resource, not the string-manipulation resource. Whenever you call FillParseTable, the necessary character-set encoding information is taken from the encoding/rendering resource. You cannot use the GetIntlResource function to access 2-byte character-type tables directly.In every script system, 2-byte characters have distinctive high-order (first) bytes that allow them to be distinguished from 1-byte characters. FillParseTable fills a 256-byte table, conceptually equivalent to a 1-byte character-set table, with values that indicate, byte-for-byte, whether the character-code value represented by that byte index is the first byte of a 2-byte character. An entry in the CharByteTable is 0 for a 1-byte character and 1 for the first byte of a 2-byte character.
If your application is processing mixed characters, it can use the table to identify the locations of the 2-byte characters as it makes a single pass through the text, rather than having to call CharacterByteType or CharacterType for each byte of the text buffer in turn. CharacterByteType and CharacterType start anew at the beginning of the text buffer each time they are called, tracking character positions up to the offset of the byte to be analyzed.
FillParseTable may move memory; your application should not call this function at interrupt time.
The table defined by CharByteTable is not dynamic; it does not get updated when the current font changes. You need to call it separately for each script run in your text.
Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)